import requests


def get_header():
    url = 'https://edu.jiuweiedu.com:4443/ecp-api/ecp-user/login'
    data = {'username': 'admin', 'password': 'admin123', 'tenantId': 999999, 'code': '8888'}
    resp = requests.post(url=url, headers={'Content-Type': 'application/json'}, json=data)
    # print(resp.json())
    # 从 响应体中，获取 data的值
    token = resp.json().get('data').get('access_token')
    header = {"Content-Type": "application/json",
              "Authorization": "Bearer " + token}
    return header


if __name__ == '__main__':
    token_data = get_header()
